﻿using System;
using System.Collections.Generic;
using Protocol.Constant;

namespace Protocol.Dto.Fight
{
    [Serializable]
    public class DealDto
    {
        public readonly List<CardDto> SelectCardLists;
        public readonly int length; // 长度
        public readonly int weight; // 权值
        public readonly int type; // 类型
        public readonly int userid; // 谁出的牌
        public bool isRegular; // 是否合法

        // 出完牌剩余的裴
        public List<CardDto> remainCardList;

        public DealDto()
        {
        }

        public DealDto(List<CardDto> _selectCardLists, int userid)
        {
            this.SelectCardLists = _selectCardLists;
            length = _selectCardLists.Count;
            type = CardType.GetCardType(_selectCardLists);
            // Because the function [GetWeight] need the [type] param.
            // 因为这句代码需要type 参数
            // 所以上一句代码必须在前面
            weight = CardWeight.GetWeight(_selectCardLists, type);
            this.userid = userid;
            isRegular = type != CardType.NONE;
            remainCardList = new List<CardDto>();
        }
    }
}